package com.yida.admin;

import java.lang.ProcessBuilder.Redirect;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import com.yida.bean.phototype;
import com.yida.service.serverphoto;

@Controller
public class adminPhotoTypeUpdate {

	@Autowired
	public serverphoto service;
	
	@RequestMapping("/admin/phototypeupdate")
	public String photo( Integer id,
			             String name,
                         String flag,
                         @RequestPart("file") MultipartFile file,
                         String password) {
		
		if (file.isEmpty()) {
			phototype phototype = new phototype();
			phototype.setId(id);
			phototype.setName(name);
			phototype.setFlag(flag);
			phototype.setPassword(password);
			
			service.phototypeupdate(phototype);
		}
		
      return  "redirect:/admin/phototype";
	}
	
	
	
}
